/**
 * ComponentGenerator.java
 *
 * Copyright (c) 2009 prjmanager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of prjmanager .
 **/

package ro.prjmanager.model;


import javax.persistence.*;

/**
 * This class from the domain model is mapping the table component_generator
 * @author Viorel Tacliciu
 * @version 0.0.1
 */

@Table(name="CUSTOM_COMPONENTS")
@Entity                                                     
public class CustomComponents {

    //define attributes that maps all columns of the coresponding table
    //this attribute maps the primary key column ID
    private java.lang.Integer id;
    //this attribute maps an bidirectional association
    //it means that FK_COMP_GEN from table history_generate is a foreign key to ID
    private String name;

    private java.util.List<HistoryGenerate> fkCompGenHistoryGenerate;
    //this attribute maps the foreign key column FK_MODEL
    private Models fkModel;
    //this attribute maps the foreign key column FK_COMPONENTS
    private GenericComponents fkComponents;
    //this attribute maps the foreign key column FK_GROUP_COMP
    private Groups fkGroups;
    //end mapping columns

    private ComponentDetails componentDetails;


    //define getters and setters with coresponding ejb3 annotation, depending of the type
    //of the relation for the column

    /**
     * Mapping the primary key
     * @return - java.lang.Integer the primary key for this entity
     **/
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    public  java.lang.Integer  getId(){
        return this.id;
    }

    /**
     * The setter for ID column
     * @param id -  an java.lang.Integer object
     **/
    public void setId( java.lang.Integer  id){
        this.id=id;
    }
    /**
     * This method maps an OneToMany relation between this table and
     * HistoryGenerate table
     * @return - an list of HistoryGenerate objects
     **/
    @OneToMany(cascade=CascadeType.ALL)
    @JoinColumn(name = "FK_COMP_GEN",referencedColumnName = "ID") 
    public java.util.List<HistoryGenerate> getFkCompGenHistoryGenerate(){
        return this.fkCompGenHistoryGenerate;
    }
    
    /**
     * This method sets the field fkCompGenHistoryGenerate of this entity
     * @param fkCompGenHistoryGenerate - an list of HistoryGenerate objects
     **/
    public void setFkCompGenHistoryGenerate(java.util.List<HistoryGenerate> fkCompGenHistoryGenerate){
        this.fkCompGenHistoryGenerate=fkCompGenHistoryGenerate;
    }
    /**
     * This method maps an ManyToOne relation between this entity and
     * models entity
     * @return - an Models object
     **/
    @ManyToOne(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_MODEL",referencedColumnName = "ID")
    public Models getFkModel(){
        return this.fkModel;
    }

    /**
     * This method sets the field fkModel of this entity
     * @param fkModel - an Models object
     **/
    public void setFkModel(Models fkModel){
        this.fkModel=fkModel;
    }
    /**
     * This method maps an ManyToOne relation between this entity and
     * components entity
     * @return - an Components object
     **/
    @ManyToOne(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_COMPONENTS",referencedColumnName = "ID")
    public GenericComponents getFkComponents(){
        return this.fkComponents;
    }

    /**
     * This method sets the field fkComponents of this entity
     * @param fkComponents - an Components object
     **/
    public void setFkComponents(GenericComponents fkComponents){
        this.fkComponents=fkComponents;
    }
    /**
     * This method maps an ManyToOne relation between this entity and
     * group_components entity
     * @return - an Groups object
     **/
    @ManyToOne(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_GROUP",referencedColumnName = "ID")
    public Groups getFkGroups(){
        return this.fkGroups;
    }

    /**
     * This method sets the field fkGroups of this entity
     * @param fkGroups - an Groups object
     **/
    public void setFkGroups(Groups fkGroups){
        this.fkGroups=fkGroups;
    }

    @ManyToOne(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_COMPONENT_DETAILS",referencedColumnName = "ID")
    public ComponentDetails getComponentDetails() {
        return componentDetails;
    }

    public void setComponentDetails(ComponentDetails componentDetails) {
        this.componentDetails = componentDetails;
    }

    @Column(name = "NAME")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}



